ShynBui commited on
Commit
7f6b51d
1 Parent(s): f47dd3c
.idea/Vietnamese_correct_spelling.iml CHANGED
@@ -4,7 +4,7 @@
4
  <content url="file://$MODULE_DIR$">
5
  <excludeFolder url="file://$MODULE_DIR$/venv" />
6
  </content>
7
- <orderEntry type="jdk" jdkName="Python 3.11 (Vietnamese_correct_spelling)" jdkType="Python SDK" />
8
  <orderEntry type="sourceFolder" forTests="false" />
9
  </component>
10
  </module>
 
4
  <content url="file://$MODULE_DIR$">
5
  <excludeFolder url="file://$MODULE_DIR$/venv" />
6
  </content>
7
+ <orderEntry type="jdk" jdkName="Python 3.11 (Vietnamese_correct_spelling) (2)" jdkType="Python SDK" />
8
  <orderEntry type="sourceFolder" forTests="false" />
9
  </component>
10
  </module>
.idea/misc.xml CHANGED
@@ -3,5 +3,5 @@
3
  <component name="Black">
4
  <option name="sdkName" value="Python 3.12" />
5
  </component>
6
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (Vietnamese_correct_spelling)" project-jdk-type="Python SDK" />
7
  </project>
 
3
  <component name="Black">
4
  <option name="sdkName" value="Python 3.12" />
5
  </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (Vietnamese_correct_spelling) (2)" project-jdk-type="Python SDK" />
7
  </project>
app.py CHANGED
@@ -2,11 +2,17 @@ import gradio as gr
2
  import spaces
3
  from transformers import pipeline
4
  import os
 
5
 
6
- pipe = pipeline("summarization", model="ShynBui/Bartpho_spelling_correction")
 
7
 
8
- def greet(text):
9
- return pipe(text, max_new_tokens= 512)[0]['summary_text']
 
10
 
11
- demo = gr.Interface(fn=greet, inputs=gr.Text(), outputs=gr.Text(), examples=eval(os.environ['DES_EXAMPLE']))
12
- demo.launch()
 
 
 
 
2
  import spaces
3
  from transformers import pipeline
4
  import os
5
+ import torch
6
 
7
+ print(torch.cuda.is_available())
8
+ summarizer = pipeline("summarization", model="ShynBui/Bartpho_spelling_correction", device=0)
9
 
10
+ @spaces.GPU
11
+ def generate(prompt):
12
+ return summarizer(prompt, max_new_tokens = 512)[0]['summary_text']
13
 
14
+ gr.Interface(
15
+ fn=generate,
16
+ inputs=gr.Text(),
17
+ outputs=gr.Text(),
18
+ ).launch()
requirements.txt CHANGED
Binary files a/requirements.txt and b/requirements.txt differ
 
test.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import torch
2
+
3
+
4
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
5
+
6
+ print(device)