Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,9 +51,27 @@ def detect_fruitveg(image):
|
|
| 51 |
result = fruitveg_classifier(image)[0]
|
| 52 |
return {result['label']: float(result['score'])}
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
#
|
| 56 |
-
demo = gr.Interface(
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
result = fruitveg_classifier(image)[0]
|
| 52 |
return {result['label']: float(result['score'])}
|
| 53 |
|
| 54 |
+
with gr.Blocks() as demo:
|
| 55 |
+
with gr.Tab("Text Classification"):
|
| 56 |
+
gr.Interface(fn=classify_text, inputs="text", outputs="label")
|
| 57 |
+
with gr.Tab("Fake News Detection"):
|
| 58 |
+
gr.Interface(fn=detect_fake, inputs="text", outputs="label")
|
| 59 |
+
with gr.Tab("General Image Classification"):
|
| 60 |
+
gr.Interface(fn=classify_image, inputs=gr.Image(type="pil"), outputs="label")
|
| 61 |
+
with gr.Tab("Leaf Disease Detection"):
|
| 62 |
+
gr.Interface(fn=detect_leaf_disease, inputs=gr.Image(type="pil"), outputs="label")
|
| 63 |
+
with gr.Tab("Fruit/Veg Detection"):
|
| 64 |
+
gr.Interface(fn=detect_fruitveg, inputs=gr.Image(type="pil"), outputs="label")
|
| 65 |
+
# def my_function(text):
|
| 66 |
+
# return "You entered: " + text
|
| 67 |
|
| 68 |
+
# demo = gr.Interface(fn=my_function, inputs="text", outputs="text")
|
| 69 |
+
# demo = gr.Interface(fn=classify_image, inputs=gr.Image(type="pil"), outputs="label")
|
| 70 |
+
demo.launch()
|
| 71 |
+
|
| 72 |
+
def classify_and_detect(text):
|
| 73 |
+
t_result = classify_text(text)
|
| 74 |
+
f_result = detect_fake(text)
|
| 75 |
+
return t_result, f_result
|
| 76 |
+
|
| 77 |
+
gr.Interface(fn=classify_and_detect, inputs="text", outputs=["label", "label"])
|