Spaces:
Runtime error
Runtime error
update app to sambanova
Browse files
app.py
CHANGED
|
@@ -5,14 +5,14 @@ from typing import Dict, List, Optional, Tuple
|
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
-
import
|
| 9 |
|
| 10 |
import modelscope_studio.components.base as ms
|
| 11 |
import modelscope_studio.components.legacy as legacy
|
| 12 |
import modelscope_studio.components.antd as antd
|
| 13 |
from config import DEMO_LIST, SystemPrompt
|
| 14 |
|
| 15 |
-
YOUR_API_TOKEN = os.getenv('
|
| 16 |
|
| 17 |
History = List[Tuple[str, str]]
|
| 18 |
Messages = List[Dict[str, str]]
|
|
@@ -70,12 +70,12 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
| 70 |
<!-- Container for GIFs -->
|
| 71 |
<div style="display: flex; justify-content: center; gap: 20px; margin-bottom: 20px;">
|
| 72 |
<!-- First GIF -->
|
| 73 |
-
<img src="https://
|
| 74 |
<!-- Second GIF -->
|
| 75 |
<img src="//img.alicdn.com/imgextra/i2/O1CN01KDhOma1DUo8oa7OIU_!!6000000000220-1-tps-240-240.gif" width="200px" />
|
| 76 |
</div>
|
| 77 |
<!-- Header Text -->
|
| 78 |
-
<h1>Qwen2.5-Coder-32B with
|
| 79 |
</div>
|
| 80 |
""")
|
| 81 |
|
|
@@ -154,13 +154,13 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
| 154 |
def postprocess(response_text):
|
| 155 |
return response_text
|
| 156 |
|
| 157 |
-
# Get the model from
|
| 158 |
-
fn =
|
| 159 |
model_name='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 160 |
preprocess=preprocess,
|
| 161 |
postprocess=postprocess,
|
| 162 |
api_key=YOUR_API_TOKEN,
|
| 163 |
-
base_url="https://api.
|
| 164 |
)
|
| 165 |
|
| 166 |
response_text = ''
|
|
|
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
+
import sambanova_gradio
|
| 9 |
|
| 10 |
import modelscope_studio.components.base as ms
|
| 11 |
import modelscope_studio.components.legacy as legacy
|
| 12 |
import modelscope_studio.components.antd as antd
|
| 13 |
from config import DEMO_LIST, SystemPrompt
|
| 14 |
|
| 15 |
+
YOUR_API_TOKEN = os.getenv('SAMBANOVA_API_KEY')
|
| 16 |
|
| 17 |
History = List[Tuple[str, str]]
|
| 18 |
Messages = List[Dict[str, str]]
|
|
|
|
| 70 |
<!-- Container for GIFs -->
|
| 71 |
<div style="display: flex; justify-content: center; gap: 20px; margin-bottom: 20px;">
|
| 72 |
<!-- First GIF -->
|
| 73 |
+
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSqrdNhqy-xaE9EXRGQdiHF4Fu0aPRWnFvjJA&s" width="200px" />
|
| 74 |
<!-- Second GIF -->
|
| 75 |
<img src="//img.alicdn.com/imgextra/i2/O1CN01KDhOma1DUo8oa7OIU_!!6000000000220-1-tps-240-240.gif" width="200px" />
|
| 76 |
</div>
|
| 77 |
<!-- Header Text -->
|
| 78 |
+
<h1>Qwen2.5-Coder-32B with SambaNova Cloud API</h1>
|
| 79 |
</div>
|
| 80 |
""")
|
| 81 |
|
|
|
|
| 154 |
def postprocess(response_text):
|
| 155 |
return response_text
|
| 156 |
|
| 157 |
+
# Get the model from sambanova_gradio
|
| 158 |
+
fn = sambanova_gradio.get_fn(
|
| 159 |
model_name='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 160 |
preprocess=preprocess,
|
| 161 |
postprocess=postprocess,
|
| 162 |
api_key=YOUR_API_TOKEN,
|
| 163 |
+
base_url="https://fast-cloud-snova-ai-dev-0-api.cloud.snova.ai/v1"
|
| 164 |
)
|
| 165 |
|
| 166 |
response_text = ''
|