whispy commited on
Commit
f528573
1 Parent(s): 9cd344f

Upload 3 files

Browse files
Files changed (2) hide show
  1. app.py +8 -14
  2. requirements.txt +2 -2
app.py CHANGED
@@ -3,7 +3,8 @@ import torch
3
  import gradio as gr
4
  import pytube as pt
5
  from transformers import pipeline
6
- from diffusers import DiffusionPipeline
 
7
 
8
 
9
  MODEL_NAME = "whispy/whisper_italian"
@@ -22,18 +23,10 @@ pipe = pipeline(
22
  device=device,
23
  )
24
 
25
- diffuser_pipeline = DiffusionPipeline.from_pretrained(
26
- "CompVis/stable-diffusion-v1-4",
27
- #custom_pipeline="speech_to_image_diffusion",
28
- #speech_model=model,
29
- #speech_processor=processor,
30
- #use_auth_token=MY_SECRET_TOKEN,
31
- #revision="fp16",
32
- #torch_dtype=torch.float16,
33
- )
34
 
35
- #diffuser_pipeline.enable_attention_slicing()
36
- #diffuser_pipeline = diffuser_pipeline.to(device)
37
 
38
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-it-en")
39
 
@@ -55,8 +48,9 @@ def transcribe(microphone, file_upload):
55
  translate = translator(text)
56
  translate = translate[0]["translation_text"]
57
 
58
- output = diffuser_pipeline(translate)
59
- image = output.images[0]
 
60
 
61
  return warn_output + text, translate, image
62
 
 
3
  import gradio as gr
4
  import pytube as pt
5
  from transformers import pipeline
6
+ from diffusers import StableDiffusionPipeline
7
+
8
 
9
 
10
  MODEL_NAME = "whispy/whisper_italian"
 
23
  device=device,
24
  )
25
 
26
+ YOUR_TOKEN="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"
27
+ image_pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision="fp16", torch_dtype=torch.float16, use_auth_token=YOUR_TOKEN)
 
 
 
 
 
 
 
28
 
29
+ image_pipe.to("cuda")
 
30
 
31
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-it-en")
32
 
 
48
  translate = translator(text)
49
  translate = translate[0]["translation_text"]
50
 
51
+ image = image_pipe(translate)["sample"][0]
52
+ #output = diffuser_pipeline(translate)
53
+ #image = output.images[0]
54
 
55
  return warn_output + text, translate, image
56
 
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  transformers
2
  torch
3
  pytube
4
- diffusers
5
- sentencepiece
 
1
  transformers
2
  torch
3
  pytube
4
+ sentencepiece
5
+ diffusers