eBlessings commited on
Commit
bc6f808
Β·
verified Β·
1 Parent(s): 93427c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -17,7 +17,10 @@ import secrets
17
  valid_api_keys = set()
18
 
19
  def generate_api_key():
20
- """Generate a secure 32-character hexadecimal API key and store it."""
 
 
 
21
  key = secrets.token_hex(16)
22
  valid_api_keys.add(key)
23
  return key
@@ -49,7 +52,9 @@ def llama_vision_inference(api_key, image):
49
 
50
  with gr.Blocks(title="Manus πŸš€") as demo:
51
  gr.Markdown("# Manus πŸš€")
52
- gr.Markdown("This Gradio Space lets you generate an API key and perform vision inference using the Llama Vision model (running in CPU mode).")
 
 
53
 
54
  with gr.Tabs():
55
  with gr.TabItem("API Key Generator"):
@@ -59,7 +64,9 @@ with gr.Blocks(title="Manus πŸš€") as demo:
59
  generate_button.click(fn=generate_api_key, outputs=key_output)
60
 
61
  with gr.TabItem("Vision Model Inference"):
62
- gr.Markdown("Enter your API key and upload an image (e.g., a Linux GUI screenshot) to run inference using the Llama Vision model.")
 
 
63
  api_key_input = gr.Textbox(label="API Key", placeholder="Enter your API key here")
64
  image_input = gr.Image(type="pil", label="Upload Image")
65
  output_text = gr.Textbox(label="Model Output", interactive=False)
@@ -67,5 +74,4 @@ with gr.Blocks(title="Manus πŸš€") as demo:
67
  run_button.click(fn=llama_vision_inference, inputs=[api_key_input, image_input], outputs=output_text)
68
 
69
  if __name__ == "__main__":
70
- # Disable SSR to avoid potential GPU-related initialization issues.
71
- demo.launch(ssr=False)
 
17
  valid_api_keys = set()
18
 
19
  def generate_api_key():
20
+ """
21
+ Generate a secure 32-character hexadecimal API key,
22
+ store it in the valid_api_keys set, and return it.
23
+ """
24
  key = secrets.token_hex(16)
25
  valid_api_keys.add(key)
26
  return key
 
52
 
53
  with gr.Blocks(title="Manus πŸš€") as demo:
54
  gr.Markdown("# Manus πŸš€")
55
+ gr.Markdown(
56
+ "This Gradio Space lets you generate an API key and perform vision inference using the Llama Vision model (running in CPU mode)."
57
+ )
58
 
59
  with gr.Tabs():
60
  with gr.TabItem("API Key Generator"):
 
64
  generate_button.click(fn=generate_api_key, outputs=key_output)
65
 
66
  with gr.TabItem("Vision Model Inference"):
67
+ gr.Markdown(
68
+ "Enter your API key and upload an image (e.g., a Linux GUI screenshot) to run inference using the Llama Vision model."
69
+ )
70
  api_key_input = gr.Textbox(label="API Key", placeholder="Enter your API key here")
71
  image_input = gr.Image(type="pil", label="Upload Image")
72
  output_text = gr.Textbox(label="Model Output", interactive=False)
 
74
  run_button.click(fn=llama_vision_inference, inputs=[api_key_input, image_input], outputs=output_text)
75
 
76
  if __name__ == "__main__":
77
+ demo.launch()