Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from IPython.display import IFrame
|
| 3 |
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
|
| 4 |
|
| 5 |
model_name = "NimaKL/FireWatch_tiny_75k"
|
|
@@ -20,25 +19,21 @@ custom_style = """
|
|
| 20 |
}
|
| 21 |
"""
|
| 22 |
|
| 23 |
-
# Define
|
| 24 |
-
def
|
| 25 |
-
return
|
| 26 |
|
| 27 |
io = gr.Interface(
|
| 28 |
fn=predict,
|
| 29 |
inputs="text",
|
| 30 |
outputs="text",
|
| 31 |
title="FireWatch",
|
| 32 |
-
description="Predict whether a data row describes a fire hazard or not.
|
|
|
|
| 33 |
output_description="Prediction",
|
| 34 |
examples=[['-26.76123, 147.15512, 393.02, 203.63'], ['-26.7598, 147.14514, 361.54, 79.4'], ['-25.70059, 149.48932, 313.9, 5.15'], ['-24.4318, 151.83102, 307.98, 8.79'], ['-23.21878, 148.91298, 314.08, 7.4'], ['7.87518, 19.9241, 316.32, 39.63'], ['-20.10942, 148.14326, 314.39, 8.8'], ['7.87772, 19.9048, 304.14, 13.43'], ['-20.79866, 124.46834, 366.74, 89.06']],
|
| 35 |
-
output_component_names=["Prediction"],
|
| 36 |
theme="Streamlit",
|
| 37 |
-
css=custom_style
|
| 38 |
-
article="<h2>FireWatch App</h2><p>This app predicts whether a data row describes a fire hazard or not. The prediction is based on a machine learning model that has been trained on a dataset of data rows.</p><h2>Data Rows Sheet</h2>"
|
| 39 |
)
|
| 40 |
|
| 41 |
-
# Add the IFrame component to the app
|
| 42 |
-
io.add_component("Sample Data Sheet", gr.outputs.HTML, show_sheet)
|
| 43 |
-
|
| 44 |
io.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
|
| 3 |
|
| 4 |
model_name = "NimaKL/FireWatch_tiny_75k"
|
|
|
|
| 19 |
}
|
| 20 |
"""
|
| 21 |
|
| 22 |
+
# Define a function to generate HTML for embedding the Google Sheets document
|
| 23 |
+
def get_sheet_html():
|
| 24 |
+
return f'<iframe src="https://docs.google.com/spreadsheets/d/1b2aAZ8ue5NI7hZ-MiNc8y4dFthbrRiXlsaEeYSHgNCM/preview" width="640" height="480"></iframe>'
|
| 25 |
|
| 26 |
io = gr.Interface(
|
| 27 |
fn=predict,
|
| 28 |
inputs="text",
|
| 29 |
outputs="text",
|
| 30 |
title="FireWatch",
|
| 31 |
+
description="Predict whether a data row describes a fire hazard or not. \
|
| 32 |
+
<br><br>Here is a <a href='https://docs.google.com/spreadsheets/d/1b2aAZ8ue5NI7hZ-MiNc8y4dFthbrRiXlsaEeYSHgNCM/preview'>Google Sheets document</a> containing sample data.",
|
| 33 |
output_description="Prediction",
|
| 34 |
examples=[['-26.76123, 147.15512, 393.02, 203.63'], ['-26.7598, 147.14514, 361.54, 79.4'], ['-25.70059, 149.48932, 313.9, 5.15'], ['-24.4318, 151.83102, 307.98, 8.79'], ['-23.21878, 148.91298, 314.08, 7.4'], ['7.87518, 19.9241, 316.32, 39.63'], ['-20.10942, 148.14326, 314.39, 8.8'], ['7.87772, 19.9048, 304.14, 13.43'], ['-20.79866, 124.46834, 366.74, 89.06']],
|
|
|
|
| 35 |
theme="Streamlit",
|
| 36 |
+
css=custom_style
|
|
|
|
| 37 |
)
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
io.launch()
|