Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,7 @@ def generate_response(input_text, image, openai_api_key, reasoning_effort="mediu
|
|
28 |
model="o1", # Using model "o1"
|
29 |
messages=messages,
|
30 |
reasoning_effort=reasoning_effort, # Set reasoning_effort for the response
|
31 |
-
max_completion_tokens=2000
|
32 |
)
|
33 |
|
34 |
return response["choices"][0]["message"]["content"]
|
@@ -62,6 +62,16 @@ def create_interface():
|
|
62 |
with gr.Blocks() as demo:
|
63 |
gr.Markdown("# Multimodal Chatbot (Text + Image)")
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
with gr.Row():
|
66 |
openai_api_key = gr.Textbox(label="Enter OpenAI API Key", type="password", placeholder="sk-...", interactive=True)
|
67 |
|
@@ -89,4 +99,4 @@ def create_interface():
|
|
89 |
# Run the interface
|
90 |
if __name__ == "__main__":
|
91 |
demo = create_interface()
|
92 |
-
demo.launch()
|
|
|
28 |
model="o1", # Using model "o1"
|
29 |
messages=messages,
|
30 |
reasoning_effort=reasoning_effort, # Set reasoning_effort for the response
|
31 |
+
max_completion_tokens=2000 # Limit response tokens to 2000
|
32 |
)
|
33 |
|
34 |
return response["choices"][0]["message"]["content"]
|
|
|
62 |
with gr.Blocks() as demo:
|
63 |
gr.Markdown("# Multimodal Chatbot (Text + Image)")
|
64 |
|
65 |
+
# Add a description after the title
|
66 |
+
gr.Markdown("""
|
67 |
+
### Description:
|
68 |
+
This is a multimodal chatbot that can handle both text and image inputs.
|
69 |
+
- You can ask questions or provide text, and the assistant will respond.
|
70 |
+
- You can also upload an image, and the assistant will process it and answer questions about the image.
|
71 |
+
- Enter your OpenAI API key to start interacting with the model.
|
72 |
+
- You can use the 'Clear History' button to remove the conversation history.
|
73 |
+
""")
|
74 |
+
|
75 |
with gr.Row():
|
76 |
openai_api_key = gr.Textbox(label="Enter OpenAI API Key", type="password", placeholder="sk-...", interactive=True)
|
77 |
|
|
|
99 |
# Run the interface
|
100 |
if __name__ == "__main__":
|
101 |
demo = create_interface()
|
102 |
+
demo.launch()
|