AhmadMustafa commited on
Commit
1336ceb
·
verified ·
1 Parent(s): c001f71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -4
app.py CHANGED
@@ -2,9 +2,47 @@ import gradio as gr
2
  from ultralytics import YOLO
3
 
4
  model = YOLO("yolo11n.pt")
5
- def greet(name):
6
- return "Hello " + name + "!!"
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
10
- demo.launch()
 
 
 
2
  from ultralytics import YOLO
3
 
4
  model = YOLO("yolo11n.pt")
 
 
5
 
6
+ def create_minimal_chat_interface():
7
+ """Create a stripped-down minimal chat interface for debugging."""
8
+
9
+ with gr.Blocks() as demo:
10
+ # Basic chatbot with no additional parameters
11
+ chatbot = gr.Chatbot(
12
+ show_label=False,
13
+ )
14
+
15
+ # Simple textbox for input
16
+ msg = gr.Textbox(
17
+ show_label=False,
18
+ placeholder="Type your message here..."
19
+ )
20
+
21
+ def respond(message, chat_history):
22
+ """Simple echo function for testing."""
23
+ chat_history.append((message, f"You said: {message}"))
24
+ return "", chat_history
25
+
26
+ msg.submit(
27
+ respond,
28
+ [msg, chatbot],
29
+ [msg, chatbot],
30
+ )
31
+
32
+ # Simple load function with no request parameter
33
+ def on_load():
34
+ chatbot_value = [(None, "Welcome! This is a minimal test interface.")]
35
+ return chatbot_value
36
+
37
+ demo.load(
38
+ on_load,
39
+ inputs=None,
40
+ outputs=[chatbot],
41
+ )
42
+
43
+ return demo
44
 
45
+ # Launch the application
46
+ if __name__ == "__main__":
47
+ app = create_minimal_chat_interface()
48
+ app.launch()