Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,11 +16,11 @@ client = Groq(api_key=api_key)
|
|
16 |
|
17 |
|
18 |
# Set device: CUDA if available, else CPU
|
19 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
20 |
|
21 |
model_id1 = os.getenv("API_KEY")
|
22 |
pipe = StableDiffusionPipeline.from_pretrained(model_id1, torch_dtype=torch.float16, use_safetensors=True)
|
23 |
-
pipe = pipe.to(
|
24 |
|
25 |
# Updated function for text generation using the new API structure
|
26 |
def generate_creative_text(prompt):
|
@@ -69,7 +69,7 @@ def process_audio(audio_path, image_option, creative_text_option):
|
|
69 |
try:
|
70 |
model_id1 = "dreamlike-art/dreamlike-diffusion-1.0"
|
71 |
pipe = StableDiffusionPipeline.from_pretrained(model_id1, torch_dtype=torch.float16, use_safetensors=True)
|
72 |
-
pipe = pipe.to(
|
73 |
image = pipe(translation).images[0]
|
74 |
except Exception as e:
|
75 |
return tamil_text, translation, creative_text, f"An error occurred during image generation: {str(e)}"
|
|
|
16 |
|
17 |
|
18 |
# Set device: CUDA if available, else CPU
|
19 |
+
# device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
20 |
|
21 |
model_id1 = os.getenv("API_KEY")
|
22 |
pipe = StableDiffusionPipeline.from_pretrained(model_id1, torch_dtype=torch.float16, use_safetensors=True)
|
23 |
+
pipe = pipe.to('cpu')
|
24 |
|
25 |
# Updated function for text generation using the new API structure
|
26 |
def generate_creative_text(prompt):
|
|
|
69 |
try:
|
70 |
model_id1 = "dreamlike-art/dreamlike-diffusion-1.0"
|
71 |
pipe = StableDiffusionPipeline.from_pretrained(model_id1, torch_dtype=torch.float16, use_safetensors=True)
|
72 |
+
pipe = pipe.to('cpu')
|
73 |
image = pipe(translation).images[0]
|
74 |
except Exception as e:
|
75 |
return tamil_text, translation, creative_text, f"An error occurred during image generation: {str(e)}"
|