Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ description = """You can build with this endpoint using Nexus Raven. The demo is
|
|
11 |
You can also use Nexus🐦⬛Raven on your laptop & by cloning this space. 🧬🔬🔍 Simply click here: <a style="display:inline-block" href="https://huggingface.co/spaces/Tonic1/NexusRaven2?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></h3>
|
12 |
Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community on 👻Discord: [Discord](https://discord.gg/GWpVpekp) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Polytonic](https://github.com/tonic-ai) & contribute to 🌟 [PolyGPT](https://github.com/tonic-ai/polygpt-alpha)
|
13 |
"""
|
|
|
14 |
raven_pipeline = pipeline(
|
15 |
"text-generation",
|
16 |
model="Nexusflow/NexusRaven-V2-13B",
|
@@ -19,18 +20,13 @@ raven_pipeline = pipeline(
|
|
19 |
)
|
20 |
|
21 |
@spaces.GPU
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
prompt = f"User Query: {input_text}<human_end>"
|
28 |
-
result = self.raven_pipeline(prompt, max_new_tokens=2048, return_full_text=False, do_sample=False, temperature=0.001)[0]["generated_text"]
|
29 |
-
torch.cuda.empty_cache()
|
30 |
-
return result
|
31 |
|
32 |
def create_interface():
|
33 |
-
converter = DialogueToSpeechConverter()
|
34 |
with gr.Blocks() as app:
|
35 |
gr.Markdown(title)
|
36 |
gr.Markdown(description)
|
@@ -42,9 +38,8 @@ def create_interface():
|
|
42 |
return app
|
43 |
|
44 |
if __name__ == "__main__":
|
45 |
-
converter = DialogueToSpeechConverter()
|
46 |
demo = gr.Interface(
|
47 |
-
fn=
|
48 |
inputs="text",
|
49 |
outputs="text",
|
50 |
examples=[
|
|
|
11 |
You can also use Nexus🐦⬛Raven on your laptop & by cloning this space. 🧬🔬🔍 Simply click here: <a style="display:inline-block" href="https://huggingface.co/spaces/Tonic1/NexusRaven2?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></h3>
|
12 |
Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community on 👻Discord: [Discord](https://discord.gg/GWpVpekp) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Polytonic](https://github.com/tonic-ai) & contribute to 🌟 [PolyGPT](https://github.com/tonic-ai/polygpt-alpha)
|
13 |
"""
|
14 |
+
|
15 |
raven_pipeline = pipeline(
|
16 |
"text-generation",
|
17 |
model="Nexusflow/NexusRaven-V2-13B",
|
|
|
20 |
)
|
21 |
|
22 |
@spaces.GPU
|
23 |
+
def process_text(input_text: str) -> str:
|
24 |
+
prompt = f"User Query: {input_text}<human_end>"
|
25 |
+
result = raven_pipeline(prompt, max_new_tokens=2048, return_full_text=False, do_sample=False, temperature=0.001)[0]["generated_text"]
|
26 |
+
torch.cuda.empty_cache()
|
27 |
+
return result
|
|
|
|
|
|
|
|
|
28 |
|
29 |
def create_interface():
|
|
|
30 |
with gr.Blocks() as app:
|
31 |
gr.Markdown(title)
|
32 |
gr.Markdown(description)
|
|
|
38 |
return app
|
39 |
|
40 |
if __name__ == "__main__":
|
|
|
41 |
demo = gr.Interface(
|
42 |
+
fn=process_text,
|
43 |
inputs="text",
|
44 |
outputs="text",
|
45 |
examples=[
|