Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,60 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
/* Force show the interface */
|
| 6 |
-
.gradio-container {
|
| 7 |
-
display: block !important;
|
| 8 |
-
visibility: visible !important;
|
| 9 |
-
opacity: 1 !important;
|
| 10 |
-
height: auto !important;
|
| 11 |
-
max-width: 1200px !important;
|
| 12 |
-
margin: 0 auto !important;
|
| 13 |
-
}
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
/* Force show main content */
|
| 21 |
-
.main, .app, .contain, #root {
|
| 22 |
-
display: block !important;
|
| 23 |
-
visibility: visible !important;
|
| 24 |
-
opacity: 1 !important;
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
/* Force show components */
|
| 28 |
-
.block, .form, .input-container, .output-container {
|
| 29 |
-
display: block !important;
|
| 30 |
-
visibility: visible !important;
|
| 31 |
-
}
|
| 32 |
-
"""
|
| 33 |
-
|
| 34 |
-
def chat_fn(message, history):
|
| 35 |
-
if not message:
|
| 36 |
-
return history
|
| 37 |
-
|
| 38 |
-
response = f"Schüler: *schweigt* ...{message[:20]}..."
|
| 39 |
-
if history is None:
|
| 40 |
-
history = []
|
| 41 |
-
|
| 42 |
-
history.append([message, response])
|
| 43 |
-
return history
|
| 44 |
-
|
| 45 |
-
# Gradio 5.x ChatInterface with aggressive CSS
|
| 46 |
-
demo = gr.ChatInterface(
|
| 47 |
-
fn=chat_fn,
|
| 48 |
-
title="Depression Training Simulator",
|
| 49 |
-
description="Professionelle Gesprächsführung mit depressiven Jugendlichen",
|
| 50 |
-
css=css,
|
| 51 |
-
theme="soft"
|
| 52 |
-
)
|
| 53 |
|
| 54 |
if __name__ == "__main__":
|
| 55 |
-
demo.
|
| 56 |
-
show_error=True,
|
| 57 |
-
debug=True,
|
| 58 |
-
server_name="0.0.0.0",
|
| 59 |
-
server_port=7860
|
| 60 |
-
)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def greet(name):
|
| 4 |
+
return f"Hello {name}!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
with gr.Blocks() as demo:
|
| 7 |
+
name = gr.Textbox(label="Name")
|
| 8 |
+
output = gr.Textbox()
|
| 9 |
+
btn = gr.Button("Greet")
|
| 10 |
+
btn.click(greet, inputs=name, outputs=output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
if __name__ == "__main__":
|
| 13 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|