Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,49 +1,19 @@
|
|
| 1 |
-
import
|
| 2 |
-
from
|
| 3 |
-
from PIL import Image
|
| 4 |
-
import torch
|
| 5 |
|
| 6 |
-
|
| 7 |
-
"
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
).to("cpu")
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|