Wall06 commited on
Commit
c84b018
·
verified ·
1 Parent(s): af1c14e

Delete modules/image_gen.py

Browse files
Files changed (1) hide show
  1. modules/image_gen.py +0 -30
modules/image_gen.py DELETED
@@ -1,30 +0,0 @@
1
- import os
2
- from huggingface_hub import InferenceClient
3
-
4
- # We use Stable Diffusion XL for high-quality 3D results
5
- MODEL_ID = "stabilityai/stable-diffusion-xl-base-1.0"
6
-
7
- def generate_food_image(dish_name):
8
- """
9
- Generates a realistic image of the food on a table using HF Inference API.
10
- """
11
- token = os.getenv("HF_TOKEN")
12
- if not token:
13
- return None, "⚠️ Error: HF_TOKEN not found in Secrets. Please add it in Space Settings."
14
-
15
- try:
16
- client = InferenceClient(model=MODEL_ID, token=token)
17
-
18
- # We specifically prompt for "on a restaurant table" and "3d render style"
19
- prompt = (
20
- f"professional food photography of delicious {dish_name} served on a rustic wooden restaurant table, "
21
- "4k resolution, cinematic lighting, photorealistic, 3d render style, steam rising, gourmet plating, "
22
- "blurred restaurant background, bokeh"
23
- )
24
-
25
- # Generate the image
26
- image = client.text_to_image(prompt)
27
- return image, "✅ Success: Image generated!"
28
-
29
- except Exception as e:
30
- return None, f"❌ Generation Failed: {e}"