Update app.py
Browse files
app.py
CHANGED
|
@@ -98,4 +98,25 @@ def generate(input_text):
|
|
| 98 |
except Exception as e:
|
| 99 |
return f"### Logic Error\n{str(e)}", ""
|
| 100 |
|
| 101 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
except Exception as e:
|
| 99 |
return f"### Logic Error\n{str(e)}", ""
|
| 100 |
|
| 101 |
+
# --- GRADIO UI ---
|
| 102 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 103 |
+
gr.Markdown("# 🚄 Gemini 2.0 Flash + Live DB Trains")
|
| 104 |
+
gr.Markdown("I can search the web and check live train connections via an MCP Server.")
|
| 105 |
+
|
| 106 |
+
with gr.Column():
|
| 107 |
+
output_textbox = gr.Markdown(label="Response")
|
| 108 |
+
input_textbox = gr.Textbox(
|
| 109 |
+
lines=3,
|
| 110 |
+
label="Ask me anything",
|
| 111 |
+
placeholder="e.g. 'Is there a train from Berlin to Munich tonight?'"
|
| 112 |
+
)
|
| 113 |
+
submit_button = gr.Button("Send", variant="primary")
|
| 114 |
+
|
| 115 |
+
submit_button.click(
|
| 116 |
+
fn=generate,
|
| 117 |
+
inputs=input_textbox,
|
| 118 |
+
outputs=[output_textbox, input_textbox]
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
if __name__ == '__main__':
|
| 122 |
+
demo.launch()
|