Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,11 +16,14 @@ translator = pipeline("translation", model="Helsinki-NLP/opus-mt-dra-en")
|
|
| 16 |
summarizer = pipeline("summarization", model="Falconsai/text_summarization")
|
| 17 |
# image_pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.float16).to("cpu")
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
def query(payload):
|
| 23 |
-
response = requests.post(
|
| 24 |
return response.content
|
| 25 |
|
| 26 |
|
|
|
|
| 16 |
summarizer = pipeline("summarization", model="Falconsai/text_summarization")
|
| 17 |
# image_pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.float16).to("cpu")
|
| 18 |
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# for image api
|
| 22 |
+
IMAGE_API_URL = "https://api-inference.huggingface.co/models/ZB-Tech/Text-to-Image"
|
| 23 |
+
img_headers = {"Authorization": f"Bearer {os.getenv('HF_API_TOKEN')}"}
|
| 24 |
|
| 25 |
def query(payload):
|
| 26 |
+
response = requests.post(IMAGE_API_URL, headers=img_headers, json=payload)
|
| 27 |
return response.content
|
| 28 |
|
| 29 |
|