1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- """
- @author: luojunhui
- """
- from datetime import datetime, timedelta
- import requests
- def generate_daily_strings(start_date, end_date):
- """
- Generate daily date_str
- :param start_date:
- :param end_date:
- :return:
- """
- start = datetime.strptime(start_date, "%Y%m%d")
- end = datetime.strptime(end_date, "%Y%m%d")
- current = start
- date_strings = []
- while current <= end:
- date_strings.append(current.strftime("%Y%m%d"))
- current += timedelta(days=1)
- return date_strings
- def whisper(video_id):
- """
- input video_id, output video_text
- :param video_id:
- :return:
- """
- url = "http://61.48.133.26:5999/video_to_text"
- body = {
- "video_id": video_id
- }
- header = {
- "Content-Type": "application/json",
- }
- response = requests.post(
- url=url,
- json=body,
- headers=header
- )
- return response.json()
- def get_text(video_id):
- """
- input video_id, output video_text
- :param video_id:
- :return:
- """
- url = "http://localhost:8888/get_text"
- body = {
- "vid": video_id
- }
- header = {
- "Content-Type": "application/json",
- }
- response = requests.post(
- url=url,
- json=body,
- headers=header
- )
- return response.json()
|