Canstralian commited on
Commit
c74fd81
·
verified ·
1 Parent(s): ff65e62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -3
app.py CHANGED
@@ -1,7 +1,45 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  demo.launch()
 
 
1
  import gradio as gr
2
 
3
+ # Function to simulate conversation with model selection
4
+ def chat_interface(user_input, selected_model):
5
+ response = f"[{selected_model}] says: You entered '{user_input}'. This is a simulated response."
6
+ return response
7
 
8
+ # List of available models
9
+ models = ["Model A", "Model B", "Model C"]
10
+
11
+ # Gradio Interface
12
+ with gr.Blocks(css=".retro-terminal {background-color: black; color: #00FF00; font-family: monospace;}") as demo:
13
+ with gr.Row():
14
+ gr.Markdown(
15
+ "### Welcome to the Retro Hacker Chat! \n"
16
+ "_Experience the retro vibe while interacting with your models._",
17
+ elem_classes="retro-terminal"
18
+ )
19
+ with gr.Row():
20
+ user_input = gr.Textbox(
21
+ label="Enter your message:",
22
+ placeholder="Type your message here...",
23
+ elem_classes="retro-terminal"
24
+ )
25
+ model_selector = gr.Dropdown(
26
+ choices=models,
27
+ label="Select Model",
28
+ value=models[0],
29
+ elem_classes="retro-terminal"
30
+ )
31
+ with gr.Row():
32
+ response_box = gr.Textbox(
33
+ label="Model Response:",
34
+ placeholder="The model's response will appear here...",
35
+ elem_classes="retro-terminal"
36
+ )
37
+ with gr.Row():
38
+ send_button = gr.Button("Send", elem_classes="retro-terminal")
39
+
40
+ # Link input and output
41
+ send_button.click(chat_interface, inputs=[user_input, model_selector], outputs=response_box)
42
+
43
+ # Launch the interface
44
  demo.launch()
45
+