Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -102,32 +102,17 @@ def export_to_file(output_text):
|
|
102 |
file.write(output_text)
|
103 |
return "Output exported to output.txt"
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
copy_button.click(fn=copy_to_clipboard, inputs=[output_field], outputs=[])
|
121 |
-
export_button.click(fn=export_to_file, inputs=[output_field], outputs=[])
|
122 |
-
|
123 |
-
interface = gr.Interface(
|
124 |
-
fn=process_image,
|
125 |
-
inputs=[image_input, prompt_input],
|
126 |
-
outputs=[output_field],
|
127 |
-
title="",
|
128 |
-
theme=gr.themes.Soft()
|
129 |
-
)
|
130 |
-
|
131 |
-
interface.launch()
|
132 |
-
|
133 |
-
app.launch()
|
|
|
102 |
file.write(output_text)
|
103 |
return "Output exported to output.txt"
|
104 |
|
105 |
+
def process_image(image, prompt):
|
106 |
+
response = ImageChat(image, prompt)
|
107 |
+
return response
|
108 |
+
|
109 |
+
app = gr.Interface(
|
110 |
+
fn=process_image,
|
111 |
+
inputs=[gr.Image(type="pil", label=""), gr.Textbox(label="Your Prompt", value="Analyze")],
|
112 |
+
outputs=[gr.HTML(label="Response")],
|
113 |
+
title="",
|
114 |
+
theme=gr.themes.Soft()
|
115 |
+
)
|
116 |
+
|
117 |
+
# Add custom JS for copy and export buttons
|
118 |
+
app.launch(share=True, inline=True, server_name="0.0.0.0", server_port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|