Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from happytransformer import HappyTextToText, TTSettings
|
3 |
+
from annotated_text import annotated_text
|
4 |
+
import difflib
|
5 |
+
from bokeh.models.widgets import Button
|
6 |
+
from bokeh.models import CustomJS
|
7 |
+
from streamlit_bokeh_events import streamlit_bokeh_events
|
8 |
+
|
9 |
+
checkpoint = "team-writing-assistant/t5-base-c4jfleg"
|
10 |
+
|
11 |
+
def diff_strings(a, b):
|
12 |
+
result = []
|
13 |
+
diff = difflib.Differ().compare(a.split(), b.split())
|
14 |
+
replacement = ""
|
15 |
+
for line in diff:
|
16 |
+
if line.startswith(" "):
|
17 |
+
if len(replacement) == 0:
|
18 |
+
result.append(" ")
|
19 |
+
result.append(line[2:])
|
20 |
+
else:
|
21 |
+
|