Spaces:
Paused
Paused
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
import os
|
|
@@ -7,9 +6,10 @@ import time
|
|
| 7 |
# Model configuration
|
| 8 |
MODEL_ID = "chendren/deepseek-dnd-lora"
|
| 9 |
API_URL = f"https://api-inference.huggingface.co/models/{MODEL_ID}"
|
| 10 |
-
API_TOKEN = os.environ.get("HUGGINGFACE_TOKEN", "")
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Example prompts
|
| 15 |
example_prompts = [
|
|
@@ -178,4 +178,4 @@ with gr.Blocks(title="D&D Content Generator", css="footer {visibility: hidden}")
|
|
| 178 |
|
| 179 |
# Launch the app
|
| 180 |
if __name__ == "__main__":
|
| 181 |
-
demo.launch()
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import os
|
|
|
|
| 6 |
# Model configuration
|
| 7 |
MODEL_ID = "chendren/deepseek-dnd-lora"
|
| 8 |
API_URL = f"https://api-inference.huggingface.co/models/{MODEL_ID}"
|
|
|
|
| 9 |
|
| 10 |
+
# Use environment variable for the token
|
| 11 |
+
# This will be set in the Hugging Face Space settings
|
| 12 |
+
headers = {"Authorization": f"Bearer {os.environ.get('HUGGINGFACE_TOKEN', '')}"}
|
| 13 |
|
| 14 |
# Example prompts
|
| 15 |
example_prompts = [
|
|
|
|
| 178 |
|
| 179 |
# Launch the app
|
| 180 |
if __name__ == "__main__":
|
| 181 |
+
demo.launch()
|