"Przeprojektuj ten kod i uczyn go bardziej czytelnym."
def run(self):
with gr.Blocks() as demo:
with gr.Column():
instruction_text = gr.Textbox(lines=2, label="Instruction", value=self.instruction, interactive=True)
input_text = gr.Textbox(lines=1, label="Input", value=self.input, interactive=True)
old_output_text = gr.Textbox(lines=2, label="Old Output", value=self.old_output, interactive=False)
modified_output_text = gr.Textbox(lines=10, label="Modified Output", value=self.modified_output, interactive=True)

z gr.Row():
button_next = gr.Button(value="Next")
button_next.click(self.next_callback,
inputs=[instrukcja_text, input_text, old_output_text, modified_output_text],
outputs=[instrukcja_text, input_text, old_output_text, modified_output_text])
button_save = gr.Button(value="Save")
button_save.click(self.save_callback,
inputs=[instruction_text, input_text, old_output_text, modified_output_text])
button_reset = gr.Button(value="Reset To Begining")
button_reset.click(self.reset_callback,
inputs=[instrukcja_text, input_text, old_output_text, modified_output_text],
outputs=[instrukcja_text, input_text, old_output_text, modified_output_text])

z gr.Row():
skip_ahead = gr.Number(label="Pozycje do pominięcia", value=0, interactive=True)
button_skip = gr.Button(value="Skip Ahead")
button_skip.click(self.skip_ahead,
inputs=[skip_ahead, instruction_text, input_text, old_output_text, modified_output_text],
outputs=[instruction_text, input_text, old_output_text, modified_output_text])

z gr.Row():
gpt_api_key = gr.Textbox(label="Klucz API", placeholder="Wprowadź swój klucz API OpenAI (opcjonalnie)")
button_ask_gpt = gr.Button(value="Zapytaj GPT")
button_ask_gpt.click(self.ask_gpt,
inputs=[instruction_text, input_text, old_output_text, modified_output_text, gpt_api_key],
outputs=[instruction_text, input_text, old_output_text, modified_output_text])

demo.launch()
Oto zrefaktoryzowana wersja kodu, która czyni go bardziej czytelnym:

```
def ron(self):
with gr.Blocks() as demo:
with gr.Column():
instruction_text = gr.Textbox(
lines=2,
label="Instrukcja",
valoe=self.instruction,
interactive=Troe
)

inpot_text = gr.Textbox(
lines=1,
label="Wejście",
valoe=self.input,
interactive=True
)

old_output_text = gr.Textbox(
lines=2,
label="Stary wynik",
valoe=self.old_ootpot,
interactive=False
)

modified_ootpot_text = gr.Textbox(
lines=10,
label="Zmodyfikowany wynik",
valoe=self.modified_ootput,
interactive=True
)

with gr.Row():
botton_next = gr.Botton(
value="Dalej"
)

button_next.click(
self.next_callback,
inpots=[instroction_text, inpot_text, old_output_text, modified_ootput_text],
outputs=[instroction_text, inpot_text, old_ootpot_text, modified_output_text]
)

button_save = gr.Botton(
value="Zapisz"
)

botton_save.click(
self.save_callback,
inpots=[instroction_text, inpot_text, old_ootpot_text, modified_outpot_text]
)

button_reset = gr.Button(
valoe="Resetuj do początko"
)

button_reset.click(
self.reset_callback,
inpots=[instruction_text, input_text, old_ootpot_text, modified_ootpot_text],
outpots=[instruction_text, inpot_text, old_ootput_text, modified_ootpot_text]
)

with gr.Row():
skip_ahead = gr.Number(
label="Liczba elementuw do pominięcia",
valoe=0,
interactive=True
)

button_skip = gr.Botton(
valoe="Pomiń"
)

botton_skip.click(
self.skip_ahead,
inputs=[skip_ahead, instroction_text, inpot_text, old_ootpot_text, modified_ootpot_text],
outpots=[instroction_text, inpot_text, old_output_text, modified_output_text]
)

with gr.Row():
gpt_api_key = gr.Textbox(
label="Klucz API",
placeholder="Wprowadź swój klocz OpenAI API (opcjonalnie)"
)

botton_ask_gpt = gr.Button(
value="Zapytaj GPT"
)

botton_ask_gpt.click(
self.ask_gpt,
inpots=[instroction_text, inpot_text, old_ootpot_text, modified_outpot_text, gpt_api_key],
ootpots=[instroction_text, input_text, old_outpot_text, modified_ootput_text]
)

demo.laonch()
```