Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,29 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
# Load the RescueSight Disaster-Request model
|
| 4 |
+
model = gr.load("models/RescueSight/Disaster-Request-DISTIL")
|
| 5 |
+
|
| 6 |
+
# Define some example tweets for testing
|
| 7 |
+
examples = [
|
| 8 |
+
"I'm trapped under rubble after the earthquake, please help!",
|
| 9 |
+
"Floodwaters are rising fast in my house, we need immediate rescue!",
|
| 10 |
+
"Stuck on the roof with my family, no way out. Send help ASAP!",
|
| 11 |
+
"Can't breathe well, trapped in the basement after the tornado hit. Help!",
|
| 12 |
+
"My car is submerged, can't get out. Need help urgently!",
|
| 13 |
+
"Building collapse, I'm stuck on the third floor. Please send help!",
|
| 14 |
+
"Fire has blocked all exits, we're trapped on the top floor. Help needed!",
|
| 15 |
+
"We're surrounded by floodwaters, stuck on the second floor with no food. Need rescue!",
|
| 16 |
+
"Gas leak in our building after the earthquake, trapped inside. Urgent help required!",
|
| 17 |
+
"My family and I are stuck in the attic with no way down. Please rescue us!"
|
| 18 |
+
]
|
| 19 |
+
|
| 20 |
+
# Create the Gradio interface
|
| 21 |
+
interface = gr.Interface(
|
| 22 |
+
fn=model.predict, # Function to be called for prediction
|
| 23 |
+
inputs=gr.Textbox(label="Input Tweet"), # Input text box for the tweet
|
| 24 |
+
outputs=gr.Label(label="Prediction"), # Output label for the prediction
|
| 25 |
+
examples=examples # Adding the example tweets
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
# Launch the Gradio app
|
| 29 |
+
interface.launch()
|