ans123 commited on
Commit
9ddf6d4
·
verified ·
1 Parent(s): 06ae1da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -16
app.py CHANGED
@@ -1,13 +1,7 @@
1
  import gradio as gr
2
  import torch
3
- from diffusers import StableDiffusionPipeline
4
  from groq import Groq
5
 
6
- # Initialize the Stable Diffusion model
7
- model_id = "stabilityai/stable-diffusion-2" # Example model
8
- sd_pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
9
- sd_pipe.to("cuda")
10
-
11
  # Initialize the Groq client with your API key
12
  client = Groq(api_key="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")
13
 
@@ -46,15 +40,11 @@ def generate_movie_content(theme):
46
  ])
47
  script = script_response["choices"][0]["message"]["content"]
48
 
49
- # Generate image
50
- image_prompt = f"A cinematic illustration of the theme: {theme}"
51
- image = sd_pipe(image_prompt).images[0]
52
-
53
- return characters, storyline, script, image
54
 
55
  def main_interface(theme):
56
- characters, storyline, script, image = generate_movie_content(theme)
57
- return f"Main Characters: {characters}\n\nStoryline: {storyline}\n\nScript: {script}", image
58
 
59
  # Gradio Interface
60
  title = "Movie Generator"
@@ -66,12 +56,11 @@ demo = gr.Interface(
66
  gr.Textbox(label="Theme", placeholder="Enter the movie theme"),
67
  ],
68
  outputs=[
69
- gr.Textbox(label="Generated Content"),
70
- gr.Image(label="Generated Image"),
71
  ],
72
  title=title,
73
  description=description,
74
  )
75
 
76
  if __name__ == "__main__":
77
- demo.launch()
 
1
  import gradio as gr
2
  import torch
 
3
  from groq import Groq
4
 
 
 
 
 
 
5
  # Initialize the Groq client with your API key
6
  client = Groq(api_key="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")
7
 
 
40
  ])
41
  script = script_response["choices"][0]["message"]["content"]
42
 
43
+ return characters, storyline, script
 
 
 
 
44
 
45
  def main_interface(theme):
46
+ characters, storyline, script = generate_movie_content(theme)
47
+ return f"Main Characters: {characters}\n\nStoryline: {storyline}\n\nScript: {script}"
48
 
49
  # Gradio Interface
50
  title = "Movie Generator"
 
56
  gr.Textbox(label="Theme", placeholder="Enter the movie theme"),
57
  ],
58
  outputs=[
59
+ gr.Textbox(label="Generated Content")
 
60
  ],
61
  title=title,
62
  description=description,
63
  )
64
 
65
  if __name__ == "__main__":
66
+ demo.launch()