Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,8 @@ from transformers import AutoTokenizer, pipeline
|
|
| 4 |
import torch
|
| 5 |
import html
|
| 6 |
import gradio as gr
|
|
|
|
|
|
|
| 7 |
import pandas as pd
|
| 8 |
|
| 9 |
# Define the device
|
|
@@ -105,7 +107,7 @@ def create_bibtex_entry(data):
|
|
| 105 |
class CombinedProcessor:
|
| 106 |
def process(self, user_message):
|
| 107 |
editorial_text = re.sub("\n", " ¶ ", user_message)
|
| 108 |
-
editorial_text = re.sub(r'\s*([
|
| 109 |
num_tokens = len(tokenizer.tokenize(editorial_text))
|
| 110 |
|
| 111 |
batch_prompts = split_text(editorial_text, max_tokens=500) if num_tokens > 500 else [editorial_text]
|
|
|
|
| 4 |
import torch
|
| 5 |
import html
|
| 6 |
import gradio as gr
|
| 7 |
+
import tempfile
|
| 8 |
+
import os
|
| 9 |
import pandas as pd
|
| 10 |
|
| 11 |
# Define the device
|
|
|
|
| 107 |
class CombinedProcessor:
|
| 108 |
def process(self, user_message):
|
| 109 |
editorial_text = re.sub("\n", " ¶ ", user_message)
|
| 110 |
+
editorial_text = re.sub(r'\s*([;:,])\s*', r' \1 ', editorial_text)
|
| 111 |
num_tokens = len(tokenizer.tokenize(editorial_text))
|
| 112 |
|
| 113 |
batch_prompts = split_text(editorial_text, max_tokens=500) if num_tokens > 500 else [editorial_text]
|