Spaces:
Build error
Build error
smdbs commited on
Commit ·
044c213
1
Parent(s): a726fd7
fix: change app.py to a gradio usage example
Browse filesEdited app.py and pinned the version of gradio to 4.42.0 and fastapi to 0.112 to avoid a breaking change of fastapi at 0.113.
- app.py +15 -5
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -1,6 +1,16 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
if __name__ == "__main__":
|
| 6 |
-
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# Sample Gradio usage
|
| 4 |
+
def greet(name, is_morning, temperature):
|
| 5 |
+
salutation = "Good morning" if is_morning else "Good evening"
|
| 6 |
+
greeting = f"{salutation} {name}. It is {temperature} degrees today"
|
| 7 |
+
celsius = (temperature - 32) * 5 / 9
|
| 8 |
+
return greeting, round(celsius, 2)
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(
|
| 11 |
+
fn=greet,
|
| 12 |
+
inputs=["text", "checkbox", gr.Slider(0, 100)],
|
| 13 |
+
outputs=["text", "number"],
|
| 14 |
+
)
|
| 15 |
if __name__ == "__main__":
|
| 16 |
+
demo.launch()
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
|
|
|
|
|
|
| 1 |
+
gradio==4.42.0
|
| 2 |
+
fastapi==0.112.2
|