Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,8 @@ import torch
|
|
| 7 |
|
| 8 |
pipe1 = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
| 9 |
pipe2 = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 10 |
-
pipe3 = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5")
|
| 11 |
-
pipe3.to("cuda" if torch.cuda.is_available() else "cpu")
|
| 12 |
|
| 13 |
def audio_to_image(audio):
|
| 14 |
|
|
@@ -19,10 +19,15 @@ def audio_to_image(audio):
|
|
| 19 |
summary = pipe2(transcription_text, max_length=50, min_length=10, do_sample=False)
|
| 20 |
summary_text = summary[0]['summary_text']
|
| 21 |
|
| 22 |
-
prompt = summary_text
|
| 23 |
-
image = pipe3(prompt).images[0]
|
| 24 |
|
| 25 |
-
return image
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
demo = gr.Interface(fn=audio_to_image, inputs=gr.Audio(), outputs="image")
|
|
|
|
| 28 |
demo.launch(share=True)
|
|
|
|
| 7 |
|
| 8 |
pipe1 = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
| 9 |
pipe2 = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 10 |
+
#pipe3 = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5")
|
| 11 |
+
#pipe3.to("cuda" if torch.cuda.is_available() else "cpu")
|
| 12 |
|
| 13 |
def audio_to_image(audio):
|
| 14 |
|
|
|
|
| 19 |
summary = pipe2(transcription_text, max_length=50, min_length=10, do_sample=False)
|
| 20 |
summary_text = summary[0]['summary_text']
|
| 21 |
|
| 22 |
+
#prompt = summary_text
|
| 23 |
+
#image = pipe3(prompt).images[0]
|
| 24 |
|
| 25 |
+
#return image
|
| 26 |
+
print("Transcription:", transcription_text)
|
| 27 |
+
print("Summary:", summary_text)
|
| 28 |
+
return transcription_text, summary_text
|
| 29 |
+
|
| 30 |
|
| 31 |
+
#demo = gr.Interface(fn=audio_to_image, inputs=gr.Audio(), outputs="image")
|
| 32 |
+
demo = gr.Interface(fn=audio_to_image, inputs=gr.Audio(), outputs=[gr.Textbox(label="Transcription"), gr.Textbox(label="Summary")])
|
| 33 |
demo.launch(share=True)
|