Spaces:
Sleeping
Sleeping
Commit
路
a3634c7
1
Parent(s):
eb62c8c
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import json
|
| 4 |
+
import streamlit as st
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
if __name__ == '__main__':
|
| 10 |
+
title = st.text_input("title", value="诪讬专讬_专讙讘")
|
| 11 |
+
# check if is it link to a page , if so, extract title
|
| 12 |
+
if title.startswith("https://"):
|
| 13 |
+
title = title.split("/")[-1]
|
| 14 |
+
from wikitalk_parser import get_wikitalk_from_api
|
| 15 |
+
|
| 16 |
+
language = st.text_input("language", value="he")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
if st.button("get talk"):
|
| 20 |
+
discussions = get_wikitalk_from_api(title, language=language)
|
| 21 |
+
output = json.dumps(discussions, ensure_ascii=False, indent=4)
|
| 22 |
+
st.json(output)
|
| 23 |
+
|
| 24 |
+
st.text_area("raw_output", value=output)
|
| 25 |
+
|