Spaces:
Running
Running
Delete app.py with huggingface_hub
Browse files
app.py
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
from difflib import Differ
|
2 |
-
|
3 |
-
import gradio as gr
|
4 |
-
|
5 |
-
|
6 |
-
def diff_texts(text1, text2):
|
7 |
-
d = Differ()
|
8 |
-
return [
|
9 |
-
(token[2:], token[0] if token[0] != " " else None)
|
10 |
-
for token in d.compare(text1, text2)
|
11 |
-
]
|
12 |
-
|
13 |
-
|
14 |
-
demo = gr.Interface(
|
15 |
-
diff_texts,
|
16 |
-
[
|
17 |
-
gr.Textbox(
|
18 |
-
label="Initial text",
|
19 |
-
lines=3,
|
20 |
-
value="The quick brown fox jumped over the lazy dogs.",
|
21 |
-
),
|
22 |
-
gr.Textbox(
|
23 |
-
label="Text to compare",
|
24 |
-
lines=3,
|
25 |
-
value="The fast brown fox jumps over lazy dogs.",
|
26 |
-
),
|
27 |
-
],
|
28 |
-
gr.HighlightedText(
|
29 |
-
label="Diff",
|
30 |
-
combine_adjacent=True,
|
31 |
-
).style(color_map={"+": "red", "-": "green"}),
|
32 |
-
)
|
33 |
-
if __name__ == "__main__":
|
34 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|