Spaces:
Sleeping
Sleeping
Trung
commited on
Commit
·
dc84e55
1
Parent(s):
8008ebc
Add application file
Browse files
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# Use the Huggingface access token to access private spaces
|
| 5 |
+
# This should be set as a secret in your public space
|
| 6 |
+
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 7 |
+
|
| 8 |
+
def main():
|
| 9 |
+
# Load the app from your private space
|
| 10 |
+
# Replace "YOUR_USERNAME/groq-chat-backend" with your actual private space name
|
| 11 |
+
interface = gr.load(
|
| 12 |
+
"hf://okeysir/tts-sync-prototype-backend",
|
| 13 |
+
hf_token=HF_TOKEN
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
# Add a custom header to clarify this is your public front-end
|
| 17 |
+
with gr.Blocks() as combined:
|
| 18 |
+
gr.Markdown("# Groq Chat Interface")
|
| 19 |
+
gr.Markdown("Powered by Groq API and hosted on Hugging Face Spaces")
|
| 20 |
+
|
| 21 |
+
# Embed the loaded interface
|
| 22 |
+
interface.render()
|
| 23 |
+
|
| 24 |
+
# Launch the combined interface
|
| 25 |
+
combined.launch()
|
| 26 |
+
|
| 27 |
+
if __name__ == "__main__":
|
| 28 |
+
main()
|