File size: 942 Bytes
ef0e0bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d71150b
808d618
fff518f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from __future__ import annotations
import openai
import gradio as gr
import os
import re
import numpy as np
import pandas as pd
import pickle
import tiktoken
from datasets import load_dataset
from git import Repo

# Set OpenAI API key
openai.api_key = os.getenv("OPENAI_API_KEY")

# Clone the repository
PAT = os.getenv("PATKEY")
repo = Repo.clone_from("https://mcbrs1a:" + PAT + "@github.com/mcbrs1a/AskQ.git", "A")

# Import the updated insidecode module
import A.insidecode

# Gradio app setup
with gr.Blocks() as app:
    with gr.Row():
        password_input = gr.Textbox(label="Password", type="password")
        question_input = gr.Textbox(label="Question")
        submit_button = gr.Button("Ask \"Q\"")
    output_field = gr.Textbox(label="Answer")

    submit_button.click(A.insidecode.chatbot_with_password, inputs=[question_input, password_input], outputs=output_field)

# Launch the app
app.launch()
###########
#####
#########