mahmoud22565 commited on
Commit
258f5bc
·
verified ·
1 Parent(s): dc27b37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -46
app.py CHANGED
@@ -1,49 +1,19 @@
1
- import gradio as gr
2
- from diffusers import StableDiffusionImg2ImgPipeline
3
- from PIL import Image
4
- import torch
5
 
6
- pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
7
- "runwayml/stable-diffusion-v1-5",
8
- safety_checker=None,
9
- torch_dtype=torch.float32
10
- ).to("cpu")
11
 
12
- def enhance(image):
13
- image = image.convert("RGB").resize((512, 512))
 
 
 
 
 
 
 
14
 
15
- prompt = """
16
- photorealistic architectural visualization,
17
- modern luxury villa,
18
- clean geometry,
19
- realistic glass reflections,
20
- subtle interior lighting visible through windows,
21
- soft global illumination,
22
- realistic shadows,
23
- professional architectural render,
24
- no painting style, no stylization
25
- """
26
-
27
- negative = """
28
- painting, watercolor, sketch, distortion,
29
- blurry, low quality, cartoon, fantasy,
30
- overexposed, oversharpen
31
- """
32
-
33
- result = pipe(
34
- prompt=prompt,
35
- negative_prompt=negative,
36
- image=image,
37
- strength=0.28,
38
- guidance_scale=6.5,
39
- num_inference_steps=14
40
- ).images[0]
41
-
42
- return result
43
-
44
- gr.Interface(
45
- fn=enhance,
46
- inputs=gr.Image(type="pil", label="Upload Architectural Image"),
47
- outputs=gr.Image(label="Enhanced Result"),
48
- title="Mahmoud AI – Architectural Enhancer (Clean Mode)"
49
- ).launch()
 
1
+ import os
2
+ from openai import OpenAI
 
 
3
 
4
+ client = OpenAI(
5
+ base_url="https://router.huggingface.co/v1",
6
+ api_key=os.environ["HF_TOKEN"],
7
+ )
 
8
 
9
+ completion = client.chat.completions.create(
10
+ model="EssentialAI/rnj-1-instruct:together",
11
+ messages=[
12
+ {
13
+ "role": "user",
14
+ "content": "What is the capital of France?"
15
+ }
16
+ ],
17
+ )
18
 
19
+ print(completion.choices[0].message)