Spaces:
Runtime error
Runtime error
created app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
import requests
|
| 4 |
+
import urllib
|
| 5 |
+
from os import path
|
| 6 |
+
from pydub import AudioSegment
|
| 7 |
+
|
| 8 |
+
img_to_text = gr.Blocks.load(name="spaces/pharma/CLIP-Interrogator")
|
| 9 |
+
|
| 10 |
+
def clip_intero_inference(uploaded_image):
|
| 11 |
+
prompt = img_to_text(uploaded_image, fn_index=1)[0]
|
| 12 |
+
return music_result
|
| 13 |
+
|
| 14 |
+
with gr.Blocks() as demo:
|
| 15 |
+
with gr.Row():
|
| 16 |
+
#in_newssource = gr.Dropdown(["Google News", "The Hindu", "Times Of India"], label='Choose a News Outlet')
|
| 17 |
+
in_image = gr.Image()
|
| 18 |
+
|
| 19 |
+
with gr.Row():
|
| 20 |
+
b1 = gr.Button("Get Positive News")
|
| 21 |
+
#b2 = gr.Button("Get Negative News")
|
| 22 |
+
|
| 23 |
+
with gr.Row():
|
| 24 |
+
#sample
|
| 25 |
+
out_prompt = gr.Textbox() #HTML(label="First News Link", show_label=True)
|
| 26 |
+
#out_dataframe = gr.Dataframe(wrap=True, datatype = ["str", "str", "markdown", "markdown", "str"])
|
| 27 |
+
|
| 28 |
+
b1.click(fn=clip_intero_inference, inputs=in_image, outputs=out_prompt)
|
| 29 |
+
#b2.click(fn=inference, inputs=in_newssource, outputs=out_dataframe)
|
| 30 |
+
|
| 31 |
+
demo.launch(debug=True, show_error=True)
|