Pijush2023 commited on
Commit
2b7c282
·
verified ·
1 Parent(s): c1ad08e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -27
app.py CHANGED
@@ -828,12 +828,6 @@
828
  # demo.launch(share=True)
829
 
830
 
831
-
832
-
833
-
834
-
835
-
836
-
837
  import gradio as gr
838
  import requests
839
  import os
@@ -1035,28 +1029,12 @@ def generate_audio_parler_tts(text, chunk_size=200):
1035
  logging.debug(f"Audio saved to {temp_audio_path}")
1036
  return temp_audio_path
1037
 
 
 
1038
 
1039
- def transcribe_function(stream, new_chunk):
1040
- try:
1041
- sr, y = new_chunk[0], new_chunk[1]
1042
- except TypeError:
1043
- print(f"Error chunk structure: {type(new_chunk)}, content: {new_chunk}")
1044
- return stream, "", None
1045
-
1046
- y = y.astype(np.float32) / np.max(np.abs(y))
1047
-
1048
- if stream is not None:
1049
- stream = np.concatenate([stream, y])
1050
- else:
1051
- stream = y
1052
-
1053
- result = pipe_asr({"array": stream, "sampling_rate": sr}, return_timestamps=False)
1054
-
1055
- full_text = result.get("text", "")
1056
-
1057
- return stream, full_text, result
1058
-
1059
-
1060
 
1061
  with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
1062
 
@@ -1097,3 +1075,11 @@ demo.queue()
1097
  demo.launch(share=True)
1098
 
1099
 
 
 
 
 
 
 
 
 
 
828
  # demo.launch(share=True)
829
 
830
 
 
 
 
 
 
 
831
  import gradio as gr
832
  import requests
833
  import os
 
1029
  logging.debug(f"Audio saved to {temp_audio_path}")
1030
  return temp_audio_path
1031
 
1032
+ # Initialize the Stable Diffusion pipeline
1033
+ pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4").to("cuda")
1034
 
1035
+ def generate_image(prompt):
1036
+ image = pipe(prompt).images[0]
1037
+ return image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1038
 
1039
  with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
1040
 
 
1075
  demo.launch(share=True)
1076
 
1077
 
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+
1084
+
1085
+