File size: 1,816 Bytes
3289271
 
 
 
 
 
 
 
 
 
 
 
 
 
9bbfcae
3289271
 
 
 
d4f8078
3289271
104ffed
3289271
 
 
 
5a8f86f
 
3289271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5a8f86f
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import gradio as gr
import os
from functools import partial
import gdown
import pandas as pd
from logs import save_logs
import gdown
import time
import pandas as pd
from config import logs_folder_id, json_url_id
from ice_cold import get_refresher
from web_scrapping_engine import get_linkedin_profile
choices = ["sofwareAG"]

title = """"""


def stream(company):
    linkedin_extracted_info = get_linkedin_profile(company)
    linkedin_extracted_info["profile"]["similar_companies"] = ""
    resp = get_refresher(linkedin_extracted_info)
    answer = "*(Latest update as per Linkedin)*\n"
    for chunk in resp:
        if chunk.choices[0].delta.content is not None:
            answer = answer + chunk.choices[0].delta.content
            yield answer
    answer_to_save = answer + "\n============\n" + str(linkedin_extracted_info)
    save_logs(company, answer_to_save, folder_id=logs_folder_id)
    
download_url = f'https://drive.google.com/uc?id={json_url_id}'
output = 'secret_google_service_account.json'
gdown.download(download_url, output, quiet=False)


with gr.Blocks(title=title,theme='nota-ai/theme',css="footer {visibility: hidden}") as demo:
    gr.Markdown(f"## {title}")
            
    with gr.Row():
        with gr.Column(scale=6):
            with gr.Row():
                with gr.Column(scale=3):
                    chat_input = gr.Textbox(placeholder="Company Name", lines=1, label="Get instant refresher on any company")
                    chat_submit_button = gr.Button(value="Submit ▶")
                    
                with gr.Column(scale=6):
                    chat_output = gr.Markdown("Waiting for company...")

                    
    fn_chat = stream

    
    chat_submit_button.click(fn=fn_chat, inputs=[chat_input], outputs=[chat_output])

demo.launch(max_threads=40)