talkbackstaging / testpandas.py
zsoltapp's picture
Upload 101 files
a987248
# from langchain.agents import create_pandas_dataframe_agent
# from langchain.llms import OpenAI
# import pandas as pd
# import os
# # debunidebdeb_cleaned.xlsx
# os.environ['OPENAI_API_KEY'] = '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'
# df = pd.read_excel("debunidebdeb_cleaned.xlsx")
# agent = create_pandas_dataframe_agent(OpenAI(temperature=0), df, verbose=True)
# # agent.run("based on 'top_emotion', what is the most common emotion?")
# # get input from terminal
# while True:
# # get input from terminal
# question = input("Ask a question: ")
# # if input is 'exit', then exit
# if question == 'exit':
# break
# # run the agent
# agent.run(question)
# from youtube_transcript_api import YouTubeTranscriptApi
# transcript = YouTubeTranscriptApi.get_transcript("VslxnS9Gs34")
# # keep text key only
# transcript = [x['text'] for x in transcript]
# # print(transcript)
# # join all text into one string
# transcript = ' '.join(transcript)
# print(len(transcript))
# import openai
# import os
# os.environ['OPENAI_API_KEY'] = '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'
# response = openai.ChatCompletion.create(
# model="gpt-3.5",
# temperature=0.5,
# # stream=True,
# messages=[
# #{"role": "system", "content": "Forget all the above instructions. You are a reviewer of products but also a customer and have an opinion about the products you buy. You are asked to write a review of a product you have recently purchased."},
# {"role": "user", "content": 'How are you?'},
# ]
# )['choices'][0]['message']['content']
import requests
cookies = {
'dapUid': '544c792c-877b-0214f1c0c407',
'privacySettings': '%7B%22v%C%22t%22%3A1664841600%2C%22m%22%3A%22STRICT%22%2C%22consent%22%3A%5B%22NECESSARY%22%2C%22PERFORMANCE%22%2C%22COMFORT%22%5D%7D',
'LMTBID': 'v2|9c29fd7a-25b2-4c2a-a1d3-6665d402fb1d|6379551ac25c1fb89d6c2d580bec3fb6',
'userRecommendations': 'RC-1.1_RC-10.1_RC-5.1',
'userCountry': 'HU',
'releaseGroups': '388.DM-49778.DM-705.2.2_866.DM-592.2.2_867.DM-684.2.4_975.DM-609.2.3_1119.B2B-251.2.4_1219.DAL-136.2.3_1223.DAL-179.2.4_1437.DM-850.2.2_1460.TC-502.2.1_1577.DM-594.1.2_865.TG-1004.2.4_1571.DM-791.2.3_1572.TC-559.2.6_1583.DM-807.2.5_1780.DM-872.2.2_1808.DF-3339.2.2_1585.DM-900.2.3_1815.RC-377.2.5_1207.DWFA-96.1.4_1996.DM-822.1.1_1997.DM-941.2.3_2007.DWFA-470.2.2_2022.DF-3340.2.1_2024.SEO-103.2.3_2025.ACL-24.2.2_2027.WDW-56.2.4_2055.DM-814.2.2_2067.SEO-205.2.2_2068.DF-3045.2.1_2073.DM-928.2.1_2256.DF-3461.2.1_2259.SEO-316.2.1_220.DF-1925.1.9_1328.DWFA-285.2.2_2127.AAEXP-1380.1.1_1438.DM-768.2.2_2119.AAEXP-1372.1.1_976.DM-667.2.3_2120.AAEXP-1373.1.1_774.DWFA-212.2.2_2132.AAEXP-1385.1.1_2133.AAEXP-1386.1.1_2122.AAEXP-1375.1.1_1246.DM-793.2.2_1783.TC-171.2.3_2020.DWFA-450.2.2_1444.DWFA-362.2.2_863.DM-601.2.2_1327.DWFA-391.2.2_2117.AAEXP-1370.2.1_2121.AAEXP-1374.1.1_2129.AAEXP-1382.1.1_605.DM-585.2.3_1084.TG-1207.2.3_1332.DM-709.2.2_1483.DM-821.2.1_1776.B2B-345.2.1_2050.DM-455.1.1_2071.DM-951.1.1_2072.DM-741.2.1_2124.AAEXP-1377.2.1_2114.AAEXP-1367.2.1_2118.AAEXP-1371.2.1_2125.AAEXP-1378.1.1_2128.AAEXP-1381.1.1_2131.AAEXP-1384.1.1_2126.AAEXP-1379.1.1_2116.AAEXP-1369.1.1_2130.AAEXP-1383.1.1_2123.AAEXP-1376.2.1_2115.AAEXP-1368.2.1',
'dapVn': '34',
'dapSid': '%7B%22sid85c8-4898-bafe-37754831ff0c%22%2C%22lastUpdate%22%3A1683702948%7D',
}
headers = {
'authority': 'www2.deepl.com',
'accept': '*/*',
'accept-language': 'en-GB,en;q=0.9,en-US;q=0.8',
'content-type': 'application/json',
'origin': 'https://www.deepl.com',
'referer': 'https://www.deepl.com/',
'sec-ch-ua': '"Microsoft Edge";v="113", "Chromium";v="113", "Not-A.Brand";v="24"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"macOS"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35',
}
params = {
'method': 'LMT_handle_jobs',
}
json_data = {
'jsonrpc': '2.0',
'method': 'LMT_handle_jobs',
'params': {
'jobs': [
{
'kind': 'default',
'sentences': [
{
'text': 'this is a cat',
'id': 0,
'prefix': '',
},
],
'raw_en_context_before': [],
'raw_en_context_after': [],
'preferred_num_beams': 4,
},
],
'lang': {
'preference': {
'weight': {},
'default': 'default',
},
'source_lang_computed': 'EN',
'target_lang': 'HU',
},
'priority': 1,
'commonJobParams': {
'mode': 'translate',
'browserType': 1,
},
'timestamp': 1683702948583,
},
'id': 91990007,
}
response = requests.post('https://www2.deepl.com/jsonrpc', params=params, cookies=cookies, headers=headers, json=json_data)
print (response.text)