Spaces:
Sleeping
Sleeping
interface_more
Browse files
app.py
CHANGED
@@ -30,10 +30,25 @@ def classify_image(inp):
|
|
30 |
return confidences
|
31 |
|
32 |
|
33 |
-
gr.Interface(fn=classify_image,
|
34 |
-
inputs=gr.Image(shape=(224, 224)),
|
35 |
-
outputs=gr.Label(num_top_classes = 2),
|
36 |
title="Demo",
|
37 |
description="Here's a sample image classification. Enjoy!",
|
38 |
-
examples=[['300104.png']]
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
return confidences
|
31 |
|
32 |
|
33 |
+
image_interface = gr.Interface(fn=classify_image,
|
34 |
+
inputs=gr.inputs.Image(shape=(224, 224)),
|
35 |
+
outputs=gr.outputs.Label(num_top_classes = 2),
|
36 |
title="Demo",
|
37 |
description="Here's a sample image classification. Enjoy!",
|
38 |
+
examples=[['300104.png']])
|
39 |
+
|
40 |
+
image_interface.launch()
|
41 |
+
|
42 |
+
text_interface = pipeline("text-generation", model="densenet")
|
43 |
+
|
44 |
+
def generate_text(prompt):
|
45 |
+
text = text_interface(prompt, max_length=50)[0]['generated_text']
|
46 |
+
return text
|
47 |
+
|
48 |
+
text_generator_interface = gr.Interface(fn=generate_text,
|
49 |
+
inputs="text",
|
50 |
+
outputs="text",
|
51 |
+
title="Text Generator",
|
52 |
+
description="Generate text using GPT-2",
|
53 |
+
examples=[["300104.png"]])
|
54 |
+
text_generator_interface.launch()
|