Tonic commited on
Commit
3400476
1 Parent(s): 27731ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -38
app.py CHANGED
@@ -5,7 +5,11 @@ import torch
5
 
6
  # Set max_split_size_mb
7
  os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:50'
8
-
 
 
 
 
9
  raven_pipeline = pipeline(
10
  "text-generation",
11
  model="Nexusflow/NexusRaven-V2-13B",
@@ -33,37 +37,21 @@ def create_interface():
33
  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)
34
  """)
35
  with gr.Row():
36
- input_text = gr.Textbox(label="Input Text", examples=[
37
- '''
38
- Function:
39
- def create_audio_sequence_order(text):
40
- """
41
- Analyzes the text and creates an order for each character and narrator segment.
42
-
43
- Args:
44
- text (str): The text containing the dialogues and narration.
45
-
46
- Returns:
47
- list: A list of tuples, each containing the character/narrator name and a segment of their dialogue/narration.
48
- """
49
- Function:
50
- def convert_text_to_speech_single_voice(text, voice):
51
- """
52
- Converts a given text to speech using a specified voice. This function is used when there is only one character in the text.
53
 
54
- Args:
55
- text (str): The text to be converted to speech.
56
- voice (str): The voice to be used for the audio generation.
57
 
58
- Returns:
59
- str: The path to the generated speech MP3 file.
60
- """
61
 
62
- User Query: Currently, one way that the wealthy distinguish themselves from others is through the collection of rare objects. In a Celebration Society, to own an “original” of something will remain significant. However, barring a desire to prevent others from enjoying the experience, it will become possible to have perfect replicas of all manner of objects including paintings and sculptures.
63
- There will still be pride of ownership in the original. Others will be able to fully enjoy the “same” piece as well.
64
- use either speech to single voice if there's no dialogue or create_audio_sequence_order if there is dialogue<human_end>
65
- ''' ,
66
- '''
 
 
67
  Function:
68
  def create_audio_sequence_order(text):
69
  """
@@ -86,15 +74,39 @@ Churchill? – Ah, here’s Miss Woodhouse – Dear Miss Woodhouse, how do you d
86
  well. This is a meeting quite in fairyland! Such a transformation! – Must not compliment, I know (...) – that would
87
  be rude, but upon my word, Miss Woodhouse, you do look – how do you like Jane’s hair? (...)
88
  use either speech to single voice if there's no dialogue or create_audio_sequence_order if there is dialogue<human_end>
89
- '''
90
- ])
91
- submit_button = gr.Button("Submit")
92
- output_text = gr.Textbox(label="Nexus🐦‍⬛Raven")
 
 
93
 
94
- submit_button.click(converter.process_text, inputs=input_text, outputs=output_text)
 
95
 
96
- return app
 
 
 
 
 
 
97
 
98
- if __name__ == "__main__":
99
- app = create_interface()
100
- app.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  # Set max_split_size_mb
7
  os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:50'
8
+ title = """# 🙋🏻‍♂️Welcome to🌟Tonic's Nexus🐦‍⬛Raven"""
9
+ description = """You can build with this endpoint using Nexus Raven. The demo is still a work in progress but we hope to add some endpoints for commonly used functions such as intention mappers and audiobook processing.
10
+ 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>
11
+ 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)
12
+ """
13
  raven_pipeline = pipeline(
14
  "text-generation",
15
  model="Nexusflow/NexusRaven-V2-13B",
 
37
  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)
38
  """)
39
  with gr.Row():
40
+ input_text = gr.Textbox(label="Input Text")
41
+ submit_button = gr.Button("Submit")
42
+ output_text = gr.Textbox(label="Nexus🐦‍⬛Raven")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
+ submit_button.click(converter.process_text, inputs=input_text, outputs=output_text)
 
 
45
 
46
+ return app
 
 
47
 
48
+ if __name__ == "__main__":
49
+ demo = gr.Interface(
50
+ fn=create_interface,
51
+ inputs="text",
52
+ outputs="text",
53
+ examples=[
54
+ ['''
55
  Function:
56
  def create_audio_sequence_order(text):
57
  """
 
74
  well. This is a meeting quite in fairyland! Such a transformation! – Must not compliment, I know (...) – that would
75
  be rude, but upon my word, Miss Woodhouse, you do look – how do you like Jane’s hair? (...)
76
  use either speech to single voice if there's no dialogue or create_audio_sequence_order if there is dialogue<human_end>
77
+ '''],
78
+ ['''
79
+ Function:
80
+ def create_audio_sequence_order(text):
81
+ """
82
+ Analyzes the text and creates an order for each character and narrator segment.
83
 
84
+ Args:
85
+ text (str): The text containing the dialogues and narration.
86
 
87
+ Returns:
88
+ list: A list of tuples, each containing the character/narrator name and a segment of their dialogue/narration.
89
+ """
90
+ Function:
91
+ def convert_text_to_speech_single_voice(text, voice):
92
+ """
93
+ Converts a given text to speech using a specified voice. This function is used when there is only one character in the text.
94
 
95
+ Args:
96
+ text (str): The text to be converted to speech.
97
+ voice (str): The voice to be used for the audio generation.
98
+
99
+ Returns:
100
+ str: The path to the generated speech MP3 file.
101
+ """
102
+
103
+ User Query: Currently, one way that the wealthy distinguish themselves from others is through the collection of rare objects. In a Celebration Society, to own an “original” of something will remain significant. However, barring a desire to prevent others from enjoying the experience, it will become possible to have perfect replicas of all manner of objects including paintings and sculptures.
104
+ There will still be pride of ownership in the original. Others will be able to fully enjoy the “same” piece as well.
105
+ use either speech to single voice if there's no dialogue or create_audio_sequence_order if there is dialogue<human_end>
106
+ '''
107
+ ]
108
+ ],
109
+ title=title,
110
+ description=description
111
+ )
112
+ demo.launch()