Spaces:
Runtime error
Runtime error
LF-netizen
commited on
Commit
·
87bee29
1
Parent(s):
a2fc379
init commit
Browse files- README.md +1 -1
- app.py +41 -0
- data.pickle +3 -0
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: AA
|
| 3 |
emoji: 🐨
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: blue
|
|
|
|
| 1 |
---
|
| 2 |
+
title: AA-r
|
| 3 |
emoji: 🐨
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: blue
|
app.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pyperclip
|
| 3 |
+
import pickle
|
| 4 |
+
import random
|
| 5 |
+
|
| 6 |
+
# Open the pickle file in read mode
|
| 7 |
+
with open("data.pickle", "rb") as file:
|
| 8 |
+
# Load the pickled dictionary from the file
|
| 9 |
+
data = pickle.load(file)
|
| 10 |
+
|
| 11 |
+
# Print the dictionary
|
| 12 |
+
|
| 13 |
+
def classify_text(num, word):
|
| 14 |
+
list_inputs = data[num][word]
|
| 15 |
+
random.shuffle(list_inputs)
|
| 16 |
+
prompt = '\n\n'.join(list_inputs)
|
| 17 |
+
return prompt + f'\n\nstreść powyższe teksty i scal je w jeden rozdział zatytuowany "{word}"'
|
| 18 |
+
|
| 19 |
+
def copy_to_clipboard(text, button):
|
| 20 |
+
pyperclip.copy(text)
|
| 21 |
+
button = 'Copied'
|
| 22 |
+
|
| 23 |
+
with gr.Blocks() as interface:
|
| 24 |
+
gr.Markdown(
|
| 25 |
+
"""
|
| 26 |
+
# <center>AA report generator hepler</center>
|
| 27 |
+
Wybierz numer ćwiczenia, sekcję i przeklej tekst do ChatGPT.
|
| 28 |
+
""")
|
| 29 |
+
with gr.Row():
|
| 30 |
+
with gr.Column():
|
| 31 |
+
inputs = gr.Dropdown(choices=list(range(10)), label="Numer ćwiczenia", value=0)
|
| 32 |
+
inputs2 = gr.Radio(choices=["wstęp", "opis stanowiska", "realizacja ćwiczenia", "wnioski"], label="Sekcja", value='wstęp')
|
| 33 |
+
button = gr.Button(value="Copy to clipboard")
|
| 34 |
+
with gr.Column():
|
| 35 |
+
output = gr.Textbox(label="Tekst do przeklejenia", value=classify_text(0, 'wstęp'))
|
| 36 |
+
|
| 37 |
+
inputs.change(classify_text, [inputs, inputs2], output)
|
| 38 |
+
inputs2.change(classify_text, [inputs, inputs2], output)
|
| 39 |
+
button.click(copy_to_clipboard, [output, button], None)
|
| 40 |
+
|
| 41 |
+
interface.launch(inline=False)
|
data.pickle
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e2bc6a5796b2d7d4cfae3043a4309e66a1444f866b6d59a0d4b8848857aefeed
|
| 3 |
+
size 105628
|