AbhinavKrishnan36 commited on
Commit
4019bd5
1 Parent(s): e03092c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -1,6 +1,18 @@
1
  import gradio as gr
2
  import torch
3
  from diffusers import StableDiffusion3Pipeline
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  # Load model
6
  model_id = "stabilityai/stable-diffusion-3.5-medium"
 
1
  import gradio as gr
2
  import torch
3
  from diffusers import StableDiffusion3Pipeline
4
+ from huggingface_hub import InferenceApi
5
+
6
+ hf_api_key = os.getenv("PRODIGY_GA_02")
7
+ if hf_api_key is None:
8
+ raise ValueError("Hugging Face API key 'PRODIGY_GA_02' not found. Ensure it is set as a secret.")
9
+
10
+ # Initialize the Hugging Face API with the restricted model and token
11
+ inference = InferenceApi(repo_id="stabilityai/stable-diffusion-3.5-medium", token=hf_api_key)
12
+
13
+ # Example inference request
14
+ response = inference(inputs="Your input text here")
15
+ print(response)
16
 
17
  # Load model
18
  model_id = "stabilityai/stable-diffusion-3.5-medium"